package com.xz.db.core;


import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


/**
 * @author cuizh
 * @version 1.0
 * @date 2021-09-01
 */
@AutoConfiguration
public class WebMvcConfig implements WebMvcConfigurer {

    private static final String FAVICON_URL = "/favicon.ico";

//    @Bean
//    public CurrentOperatorMethodArgumentResolver currentMethodArgumentResolver() {
//        return new CurrentOperatorMethodArgumentResolver();
//    }

//    @Override
//    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
//        resolvers.add(currentMethodArgumentResolver());
//    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/excel/**")
                .addResourceLocations("classpath:/excel/")
                .addResourceLocations("file:./excel/");
        registry.addResourceHandler("/static/**")
                .addResourceLocations("classpath:/static/")
                .addResourceLocations("file:./static/");
        registry.addResourceHandler("/logs/**")
                .addResourceLocations("classpath:/logs/")
                .addResourceLocations("file:./logs/");
        // 解决 SWAGGER 404报错
        registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("/webjars*").addResourceLocations("classpath:/META-INF/resources/webjars/");
    }






}
